package com.leadingsoft.pwxk.converter;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.leadingsoft.common.converter.AbstractConverter;
import com.leadingsoft.pwxk.dto.WaterDrainInfoDto;
import com.leadingsoft.pwxk.model.WaterDrainInfo;
import com.leadingsoft.pwxk.repository.WaterNormRepository;

/**
 * @author: lipan 2018年5月15日
 * @description: ()
 * 
 */

@Component
public class WaterDrainInfoConverter extends AbstractConverter<WaterDrainInfo, WaterDrainInfoDto> {

	@Autowired
	private WaterNormRepository waterNormRepository;

	@Override
	protected WaterDrainInfoDto toDtoActual(WaterDrainInfo model) {

		WaterDrainInfoDto dto = new WaterDrainInfoDto();
		dto.setId(model.getId());
		dto.setDataid(model.getDataid());
		dto.setDrainname(model.getDrainname());
		dto.setEmissiontime(model.getEmissiontime());
		dto.setFunctionname(model.getFunctionname());
		dto.setLatitude(model.getLatitude());
		dto.setNaturelatitude(model.getNaturelatitude());
		dto.setNaturelongitude(model.getNaturelongitude());
		dto.setPffsname(model.getPffsname());
		dto.setPfqxname(model.getPfqxname());
		dto.setRemarks(model.getRemarks());
		dto.setSewagename(model.getSewagename());
		dto.setLongitude(model.getLongitude());
		dto.setXkdraincode(model.getXkdraincode());

//		WaterNorm waterNorm = waterNormRepository.findByXkdraincode(model.getXkdraincode());
//
//		if (waterNorm != null) {
//			dto.setEmissionname(waterNorm.getEmissionname());
//			dto.setEmissioncon(waterNorm.getEmissioncon());
//		}

		return dto;
	}

	public void copyProperties(WaterDrainInfo model, WaterDrainInfoDto dto) {
		// model.setId(dto.getId());
		// model.setDataid(dto.getDataid());

	}

}
